<?php
	include_once '../../conn/all.php';
	//$id=$_GET['id'];
	$user=$_GET['user'];
	$res=sql("s", "code", "*","where user='".$user."' order by act asc,id desc");
	
	$num=count($res);
	$num1=$num;
	
		$num=$num-1;
	
	if (isset($_GET['pageno'])) {
		$pageno=$_GET['pageno'];
	}else{
		$pageno=0;
	}
	$star=$pageno*20;
	$res=sql("s", "code", "*","where user='".$user."' order by act asc,id desc limit ".$star.",20");
	
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="../templates/met/images/css/reset.css" rel="stylesheet" />
<link rel="stylesheet" type="text/css" href="../templates/met/images/css/metinfo.css" />
<script type="text/javascript"src="../include/metvar.js"></script>
<script type="text/javascript" src="../include/metinfo.js"></script>
<script type="text/javascript" src="../../public/js/metinfo-min.js"></script>
<script type="text/javascript" src="../templates/met/images/js/iframes.js"></script>
<script type="text/javascript" src="../templates/met/images/js/cookie.js"></script>
<style type="text/css">
body{
	font-size: ; 
	font-family:;
	text-align:center;
}
</style>
<script type="text/javascript">
//ajax执行时间
var time=200;
var lang = 'cn';
var metimgurl='../templates/met/images/';
</script>
<script type="text/javascript">
	$(document).keypress(function(e){  
	var type = e.keyCode||e.which||e.charCode;
		if(type==27){ 		
			parent.sitemp('set/sitemap.php?lang=cn&admintp=&langset=cn');  
		}				
	});
</script>
<script >
function create(){
	var url=document.getElementById('url').value;
	document.getElementById('code').src="code_create.php?user=<?=$user;?>&url="+url;
	alert("密码卡生成成功！");

}
</script>
<title>密码卡管理</title>
</head>
<body>
<table cellpadding="2" cellspacing="1" class="table">
          <tr> 
            <td colspan="3" class="title"  align="center">密码卡管理</td>
          </tr>
 		<tr> 
            <td colspan="3"   align="left" ><form name="form" method='post' action="code_create.php?user=<?=$user;?>"><span  style="margin:5px; padding:5px;height:23px;">连接url地址：</span>
             
            <input name="url" type="text" id="url" value="http://lovevi.cn/?user=<?=$user;?>" style="margin:5px; padding:5px;height:25px;"  size="40"> 
            <input type="submit"  style="margin:5px; padding:5px"  name=""  value="生成密码卡" >
            </form>
            </td>
          </tr>
	  	<tr>
			 <td colspan="3">
			  <form name="del" method="post" action="delete.php?lang=cn">
			  <table cellpadding="0" cellspacing="0" class="table neitable" style="margin:0px; border:none;">
              <tr>
                <td width="40" class="list">选择</td>
				<td width="50" class="list">ID</td>
				<td class="list" >卡号</td>
				<td class="list" >连接url</td>
				<td class="list" >是否使用</td>                
                <td class="list" >生成时间</td>

              </tr>
 <?php 
	$level=arrayLevel($res);
	if ($level==1) {
		$info=$res;
		echo '<tr class="mouse click">';
		echo ' <td class="list-text"><input name="id" type="checkbox" id="id" value="3" /></td>';
		echo '<td class="list-text">'.$info['id'].'</td>';
		echo '<td class="list-text" >'.$info['code'].'</td>';
		echo '<td class="list-text" >'.$info['url'].'</td>';
		echo '<td class="list-text" >'.$info['act'].'</td>';
		echo '<td class="list-text" >'.$info['time'].'</td>';
		echo '</tr>';
	}elseif($level>1){
		foreach ($res as $info){
			echo '<tr class="mouse click">';
			echo ' <td class="list-text"><input name="id" type="checkbox" id="id" value="3" /></td>';
			echo '<td class="list-text">'.$info['id'].'</td>';
			echo '<td class="list-text" >'.$info['code'].'</td>';
			echo '<td class="list-text" >'.$info['url'].'</td>';
			echo '<td class="list-text" >'.$info['act'].'</td>';
			echo '<td class="list-text" >'.$info['time'].'</td>';
			echo '</tr>';
		}
	
	}
?>		         
         <tr> 
            <td colspan="6" class="title"  align="center"><?php if ($pageno==0) { echo "上一页";}else{?> <input type="button" name="button"  value="上一页" onClick="pre()"> <?php }; if ($pageno==floor($num/20)) { echo "　下一页";}else{?>　<input type="button" name="button"  value="下一页" onClick="next()"><?php };?> 　页次：<span id="now_page"><?=$pageno+1;?>/<?php echo floor($num/20)+1;?></span>页　 共<?=$num+1;?>条信息　 <input name="pageno" type="text" id="pageno" size="4">
    <input type="button" name="button" id="button" value="GO" onClick="go()"> <input name="pageno" value='0' type="hidden" id="pageno" size="4"></td>
          </tr>
		<tr>
		  <td class="footer" colspan="3"> </td>
	  </tr>
</table>
<iframe src="" id="code" style="display:none"></iframe> 
</body>
</html>
